<script type="text/javascript">
    $(function () {
        $("#btnSave").click(function () {
            if (!checkForm(document.getElementById("saveForm"))) {
                return;
            }
            $("#btnSave").blur();
            showLoading();
            fy_api.ajaxSubmit($("#saveForm"),{
                success: function (data) {
                    hideLoading();
                    if (!isSuccess(data)) {
                        $.messager.alert('系统提示', data.msg, 'error', function () {
                            self.focus();
                        });
                    } else {
                        parent.grid_get("grid").datagrid("load");
                        turnBack();
                    }
                }
            });
        });
        var keyId = (getUrlParam("keyId", url));
        if(keyId != ""){
            //编辑
            fy_api.load_template({
                controller: $("#saveForm").attr("templateParam", "keyId=" + keyId), loading: true, initValue: true, loaded: function(){
                    loaded(keyId);
                }
            });
        }else{
            //添加
            $("#divEdit").remove();
            fy_api.load_template({
                controller: $("#saveForm").attr("templateParam", "keyId=" + keyId), loading: true,initValue: true, loaded: function(){
                    $("#saveForm").attr("action","server/save.do")
                }
            });
        }
    });
    function turnBack() {
        parent.j_closeWin();
    }
</script>
<form action="server/update.do" method="post" id="saveForm" templateUrl="server/get.do">
    <div id="divEdit">
        <input type="hidden" name="id" value="${id}" />
        <input type="hidden" name="deleteFlag" value="${deleteFlag}" id="deleteFlag"/>
    </div>
    <table style="margin: 10px auto;border: 1px solid darkgrey;padding: 10px">
        <tr>
            <td>
                <div class="div-label"><span class="nullTip">*</span>外网IP地址：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" isNull="外网IP地址" name="outerIp" id="outerIp" value="${outerIp}" />
                </div>
            </td>
            <td>
                <div class="div-label"><span class="nullTip">*</span>内网IP地址：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" isNull="内网IP地址" name="innerIp" id="innerIp" value="${innerIp}" />
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label"><span class="nullTip">*</span>登陆用户名：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" isNull="登陆用户名" name="user" id="user" value="${user}" />
                </div>
            </td>
            <td>
                <div class="div-label"><span class="nullTip">*</span>密码：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" isNull="密码" name="pass" id="pass" value="${pass}" />
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">服务器类型：</div>
            </td>
            <td>
                <div class="div-item">
                    <select name="type" id="type" style="width: 160px;" value="${type}" >
                        <option value="0" >阿里服务器</option>
                        <option value="1" >哈尔滨服务器</option>
                        <option value="2" >其它服务器</option>
                    </select>
                </div>
            </td>
            <td>
                <div class="div-label">状态：</div>
            </td>
            <td>
                <div class="div-item">
                    <select name="status" id="status" style="width: 160px;" value="${status}" >
                        <option value="1" >启用</option>
                        <option value="0" >禁用</option>
                    </select>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">内存：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="memory" id="memory" value="${memory}" />
                </div>
            </td>
            <td>
                <div class="div-label">CPU：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="cpu" id="cpu" value="${cpu}" />
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">磁盘1：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="disk1" id="disk1" value="${disk1}" />
                </div>
            </td>
            <td>
                <div class="div-label">磁盘空间1：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" isNum="磁盘空间1" numType="1" notFill="1" name="diskSpace1" id="diskSpace1" value="${diskSpace1}" />
                    <span style="font-weight: bold;color: red;margin-left:5px">G</span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">磁盘2：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="disk2" id="disk2" value="${disk2}" />
                </div>
            </td>
            <td>
                <div class="div-label">磁盘空间2：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" isNum="磁盘空间2" numType="1" notFill="1" name="diskSpace2" id="diskSpace2" value="${diskSpace2}" />
                    <span style="font-weight: bold;color: red;margin-left:5px">G</span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">磁盘3：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="disk3" id="disk3" value="${disk3}" />
                </div>
            </td>
            <td>
                <div class="div-label">磁盘空间3：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" isNum="磁盘空间3" numType="1" notFill="1" name="diskSpace3" id="diskSpace3" value="${diskSpace3}" />
                    <span style="font-weight: bold;color: red;margin-left:5px">G</span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">磁盘4：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="disk4" id="disk4" value="${disk4}" />
                </div>
            </td>
            <td>
                <div class="div-label">磁盘空间4：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" isNum="磁盘空间4" numType="1" notFill="1" name="diskSpace4" id="diskSpace4" value="${diskSpace4}" />
                    <span style="font-weight: bold;color: red;margin-left:5px">G</span>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label"><span class="nullTip">*</span>类别：</div>
            </td>
            <td>
                <div class="div-item">
                    <select name="serverType" id="serverType" style="width: 160px;" value="${serverType}" >
                        <option value="1" >DB服务器</option>
                        <option value="0" >应用服务器</option>
                    </select>
                </div>
            </td>
            <td>
                <div class="div-label">备注：</div>
            </td>
            <td>
                <div class="div-item">
                    <input type="text" name="remark" id="remark" value="${remark}" style="width: 95%"/>
                </div>
            </td>
        </tr>
    </table>
</form>
<div class="form-buttons">
    <a id="btnSave" class="easyui-linkbutton" iconCls="icon-save">保存</a>
    <a id="btnBack" class="easyui-linkbutton c2" iconCls="icon-undo" onClick="turnBack();">返回</a>
</div>